<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="../favicon.gif" type="image/gif" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>运营后台</title>
<link rel="stylesheet" href="statics/framework.css" type="text/css" media="screen, projection">
<!--[if IE]>
<link rel="stylesheet" href="styles/ie.css" type="text/css" media="screen, projection">
<script type="text/javascript" src="js/pngfix/iepngfix_tilebg.js"></script>
<![endif]-->
<link rel="stylesheet" href="statics/struct.css" type="text/css" media="screen, projection">
<script type="text/javascript" src="js/mootools-1.2-core-yc.js"></script>
<script type="text/javascript" src="js/category.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript">
<!--
	function deleteImg(int_id) {
        var img = $("image_"+int_id);
        if (img) {
            img.parentNode.removeChild(img);
            img = $("old_img_"+int_id);
            if (img) {
                img.parentNode.removeChild(img);    
            }
        }
    }


//-->
</script>
</head>
<body>
<div class="container clearfix" id="container">
  <div id="header" class="header">
    <div id="logo">运营后台</div>
  </div>

<!-- side -->
<div id="sidecontent">
<div id="submenu_order">
<div class="grouplevel_1 grouplevel_1_withchild">&nbsp&nbsp管理员：<{$username}> &nbsp&nbsp<a href="login.php?action=quit">退出</a>
</div>
<{ foreach item=html_arr from=$html_arr name="cat" }>
<div class="grouplevel_1 grouplevel_1_withchild" onclick="open_div('m<{$smarty.foreach.cat.index}>');"><span class="title" ><a href="#"><{$html_arr.m_name}></a></span></div>

<div id="m<{$smarty.foreach.cat.index}>" {! if $html_arr.m_id != $sel !} style="display:none;" {!/if!}>
    <{ foreach item=html_items from=$html_item[$html_arr.m_id] }>
    <div class="grouplevel_2" ><a href="{! if $html_items.url !}{!$html_items.url!}{!else!}#{!/if!}"><{$html_items.m_name}></a></div>
    <{/foreach}>
</div>
<{/foreach}>
</div>
</div>
<script type="text/javascript">
function open_div(obj){
    var el = $(obj);
    var display = el.style.display;
    el.style.display = (display == 'none' ? '' : 'none');
}
</script>
<!-- side -->

<!-- main workground -->
<script type="text/javascript">
function toggleSide(o) {
	var el = $('sidecontent');
	var display = el.style.display;
	el.style.display = (display == 'none' ? '' : 'none');
	$('workground').style.marginLeft = (display == 'none' ? '171px' : '10px');
	o.className = (display == 'none' ? 'openLeft' : 'closeLeft');
}
function $(el) {
	return document.getElementById(el);
}
</script>
<div id="leftToggler" class="openLeft" title="开启或关闭侧边栏" onclick="toggleSide(this)"> </div>
<div id="workground">
  <div class="navBar"><span>ShopEx运营后台</span> > <span>产品管理</span> > <span>商品编辑</span></div>
<!-- 第一步-->



<div class="tableform">
<form method="post" action="product.php?act={! if $action=="add" !}doadd{! else !}update{! /if !}" enctype="multipart/form-data">
    <input type="hidden" id="c_id" name="c_id" value="{! $array_product.c_id !}" />
    {! if $t_id !}
    <input type="hidden" id="t_id" name="t_id" value="{! $t_id !}" />
    {! /if !}
    
    <input type="hidden" id="s_id_insert" name="s_id" value="" />
    
    {! if $action=="add" !}
    {! else !}
    <input type="hidden" id="p_id" name="p_id" value="{! $array_product.p_id !}" />
    {! /if !}
		<div class="division">
        	<table width="100%" cellspacing="0" cellpadding="0" border="0">
            <tbody>
            
            <tr>
             <th>商品名称：</th>
            <td><input type="text" name="p_name" value="{! $array_product.p_name|htmlspecialchars !}" /></td>
            </tr>
             <tr>
             <th>商品编码：</th>
            <td><input type="text" name="p_bn" value="{! $array_product.p_bn|htmlspecialchars !}" /></td>
            </tr>
            <tr>
             <th>产品所属类目：</th>
            <td>
                    {! if $action=="add" !}
                        <select name="cl_0" id="cl_0" level="0" onchange="newChildSelect(this, 'c_id', 'cl_')">
                            <option value="">请选择</option>
							{! section name=cate loop=$array_all_category !}
                            <option value="{! $array_all_category[cate].c_id !}">{! $array_all_category[cate].c_name !}</option>
                            {! /section !}
                        </select>
                    {! else !}
                        {! section name=lv loop=$array_categories !}
                        <select name="cl_{! $smarty.section.lv.index !}" id="cl_{! $smarty.section.lv.index !}" level="{! $smarty.section.lv.index !}" onchange="newChildSelect(this, 'c_id', 'cl_')">
							<option value="">请选择</option>
                            {! section name=cate loop=$array_all_category[lv] !}
                            <option value="{! $array_all_category[lv][cate].c_id !}"{! if $array_categories[lv].id==$array_all_category[lv][cate].c_id !} selected="selected"{! /if !}>{! $array_all_category[lv][cate].c_name !}</option>
                            {! /section !}
                        </select>
                        {! /section !}
                    {! /if !}
            </td>
            </tr>
             <tr>
             <th>品牌：</th>
            <td><input type="text" name="p_trademark" value="{! $array_product.p_trademark|htmlspecialchars !}" /></td>
            </tr>
            <tr>
             <th>价格：</th>
            <td>淘宝价：<input type="text" name="p_sale_price" value="{! $array_product.p_sale_price !}" />代销价：<input type="text" name="p_original_price" value="{! $array_product.p_original_price !}" /></td>
            </tr>
            <tr>
             <tr>
             <th>所属公司：</th>
            <td>
            	<p>搜索关键字：<input type="text" name="supplier_keyword" id="supplier_keyword" value="">
                <input type="button" value="搜索" onclick="getSearchSupplier('','s_id',0)">&nbsp;<input type="button" value="显示全部" onclick="getSearchSupplier(1,'',0)"></p>
                <div id="s_id">
                <select name="s_id"  >
                    {! section name=supplier loop=$array_supplier !}
                    <option value="{! $array_supplier[supplier].user_id !}"{! if $array_supplier[supplier].user_id==$array_product.s_id !} selected="selected" {! /if !}>{! $array_supplier[supplier].s_name !}</option>
                    {! /section !}
                </select>
                </div>
            </td>
            </tr>
            <tr>
            <tr>
            <th>产品关键字：</th>
            <td><textarea name="p_simple_content" style="width: 500px; height: 50px; font-size:12px">{! $array_product.p_simple_content|htmlspecialchars !}</textarea></td>
            </tr>
            <tr>
            <th>详细说明：</th>
            <td>{! $p_content !}</td>
            </tr>
            <tr>
            <th>商品图片：</th>
            <td>
                图片1：<input type="file" name="img1" /><br />
                图片2：<input type="file" name="img2"/><br />
                图片3：<input type="file" name="img3"/><br />
                图片4：<input type="file" name="img4"/><br />
                <span class="infotips">最多可上传4张图片，一次可上传多张，大小不超过200k</span>
            <br/>
            <div style="border: 2px solid rgb(232, 232, 232); margin: 10px 0pt; padding: 10px; width: 480px;" class="clearfix">
            
            {! section name=images loop=$array_p_images !}
            {! if $array_p_images[images] !}
            <div class="picbox" id="image_{! $smarty.section.images.rownum !}">
            <div style="width: 40px;" class="pictext">图片</div>
            <div class="pic"><img width="110" src="{! $array_p_images[images] !}"/>  </div>
            <div class="pictext"><a onclick="return confirm('确认要删除么？')" href="javascript:deleteImg({! $smarty.section.images.rownum !})">删除</a></div>
            </div>
            <input type="hidden" id="old_img_{! $smarty.section.images.rownum !}" name="img[]" value="{! $array_p_images[images] !}" />
            {! /if !}
            {! /section !}
            
          	</div>
            </td>
            </tr>
            </tbody>
            </table>
        	</div>
        	{! if 'status' == $type !}
        	<input type="button" name="btnSubmit" value="审核通过" onclick="location.href='product.php?act=status&id={!$p_id_new!}&value=1'"/>&nbsp;<input type="button" name="btnSubmit" value="审核不通过" onclick="location.href='product.php?act=status&id={!$p_id_new!}&value=2'"/>
        	{! else !}
        	<input type="submit" name="btnSubmit" value="提交" />
        	{! /if !}
			</form>
        </div>
</div>
</div>

</body>
</html>
